<?php
defined('SEJUJOPEFDNGJSL') or exit('Access denied');
$act=$_POST['act'];
if(!empty($act)&&$act="edit"){
	$pid=intval($_POST['pid']);
	$receiver=$_POST['receiver'];
	$mobile=$_POST['mobile'];
	$address=$_POST['address'];
	$db->query("update ld_order set bsname='".$receiver."',baddress='".$address."',bphone='".$mobile."' where id=".$pid,4);
    show_automsg('修改成功！',YMCURL.'orderedit&id='.$pid);
}

$id=$_GET['id'];
$db->query("select * from ld_order where id=".$id,2);
$rs=$db->rs;
if($rs['status']==1){
   $status='<font color="red">未发货</font>';
}elseif($rs['status']==2){
  $status='已发货';
}else{
  $status='已签收';
}
?>
<link rel="stylesheet" type="text/css" href="../css/pintuer.css">
<link rel="stylesheet" type="text/css" href="../css/admin.css">
<link rel="stylesheet" type="text/css" href="../css/manage.css">
<div class="righttop">
  <span class="icon-home"></span> 首页 <span class="gray">/</span> 订单列表
</div>
<div class="panelbox">
    <div class="panel admin-panel">
        <div class="panel-head">
          <strong><span class="icon-edit"></span>
            修改信息
          </strong>
        </div>
        <div class="padding border-bottom" style="height: auto;overflow: hidden;padding:0px;">
        	<table class="orderlist_table">
        		<tr><th colspan="4">产品列表</th></tr>
			  <tbody>
		        <tr>
		          <td>产品编号</td>
		          <td>产品名</td>
		          <td>库存量</td>
		          <td>单价</td>
		        </tr>
				<?php 
				$db->query("select * from ld_product where id=".$rs['bpid'],2);
				$req=$db->rs;
				?>
		        <tr>
		          <td><?php echo $req["id"]?></td>
		          <td><?php echo $req["productname"]?></td>
		          <td><?php echo $req["num"]?></td>
		          <td><?php echo $req["price"]?></td>
		        </tr>
				</tbody>
		     </table>
        </div>
        <div class="body-content">
        	<!-- 表格表格 -->
        	<form name="form1" method="post" action="">
        	<input type="hidden" name="act" value="edit">
        	<input type="hidden" name="pid" value="<?php echo $rs['id'];?>">


			  <table class="modifytable">
				<tr>
				  <td class="leftb">订单编号:</td>
				  <td><?php echo $rs['id'];?></td>
				 </tr>
				<tr>
				  <td class="leftb">订购会员:</td>
				  <td><?php echo $rs["bname"]?> </td>
				</tr>
				<tr>
				  <td class="leftb">订单时间:</td>
				  <td><?php echo date("Y-m-d",$rs["btime"])?> </td>
				</tr>
				<tr>
				  <td class="leftb">状态:</td>
				  <td><?php echo $status?> </td>
				</tr>
				<tr>
				  <td class="leftb">购买的数量:</td>
				  <td><?php echo $rs["bnum"]?> </td>
				</tr>
				<tr>
				  <td class="leftb">购买单价:</td>
				  <td><?php echo $rs["bprice"]?> </td>
				</tr>
				<tr>
				  <td class="leftb">总价格:</td>
				  <td><?php echo $rs['bnum']*$rs["bprice"]?> 积分</td>
				</tr>
				<tr>
				  <td class="leftb">收件人:</td>
				  <td><input name="receiver" type="text" id="receiver" class="input w50" value="<?php  echo $rs["bsname"]?>"> </td>
				</tr>
				<tr>
				  <td class="leftb">联系电话:</td>
				  <td><input name="mobile" type="text" id="mobile" class="input w50" value="<?php  echo $rs["bphone"]?>"> </td>
				</tr>
				<tr>
				  <td class="leftb">地址:</td>
				  <td><input name="address" type="text" id="address" class="input w50" value="<?php  echo $rs["baddress"]?>"> </td>
				</tr>
				<?php
			    if($rs['status']>=2){
				?>
				<tr>
				<td class="leftb">发货时间:</td>
				<td level="0_3"><?php echo date("Y-m-d",$rs["bftime"]);?>
				</td>
				</tr>
				<tr>
				<td class="leftb">快递方式:</td>
				<td level="0_3"><?php echo $rs["bftype"];?>
				</td>
				</tr>
				<tr>
				<td class="leftb">物流单号:</td>
				<td level="0_3"><?php echo $rs["bfbianhao"];?></td>
				</tr>
				<tr level="0">
				<td class="leftb">备注:</td>
				<td><?php echo $rs["beizhu"];?></td>
				</tr>
				<?php } ?>
				<tr>
					<td class="leftb"></td>
				  </tr>
                <tr>
					<td class="leftb"></td>
				  	<td>
					  <button class="button bg-main" type="submit"  id="but" value="" name="but">
					  	<span class="icon-check-square-o"></span> 确认
					  </button>
					  <button class="button bg-red" type="button"  id="but" value="" name="but" onClick="history.back();">
					    	<span class="icon-mail-reply"></span> 返回
					  </button>
				    </td>
				  </tr>
			    </table>
			</form>
        	<!-- 结束结束 -->
        </div>
    </div>
</div>
